;;; init-base-config.el --- Base configuration  -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

;; Set UTF-8 as the default coding system
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(setq selection-coding-system 'utf-8)
(setq locale-coding-system 'utf-8)

;; Some basic setting
(setq inhibit-splash-screen    t
      line-number-mode         nil
      initial-scratch-message  nil
      create-lockfiles         nil
      make-backup-files        nil
      help-window-select       t
      confirm-kill-processes   nil
      frame-resize-pixelwise   t
      read-process-output-max  (* 4 1024 1024)
      use-short-answers        t)

(tooltip-mode -1)



;; Set default shell environment
(setenv "SHELL" "/bin/zsh")
(setq explicit-shell-file-name "/bin/bash")

;; Do not show any words in echo area when emacs startup.
;; Three ways to achieve it.
;; 1. put this in any configuration file
;; (put 'inhibit-startup-echo-area-message 'saved-value t)
;; (setq inhibit-startup-echo-area-message "YOUR-USER-NAME")
;; 2. put this in use-init-file, aka ~/.emacs
;; (setq inhibit-startup-echo-area-message "YOUR-USER-NAME")
;; 3. redefine function display-startup-echo-area-message
;; (fset 'display-startup-echo-area-message 'ignore)
(fset 'display-startup-echo-area-message (lambda () (message "这个世界有很多黑暗的地方，我们要尽量让自己生活在光明里。")))

;; Point goes to the last place where it was when you previously visited
(setq save-place-forget-unreadable-files nil)
(save-place-mode 1)

;; Configuration for recentf-mode
(setq recentf-max-saved-items 100
      recentf-auto-cleanup    'mode)
(recentf-mode 1)
(add-to-list 'recentf-exclude "/notes_site/")



(setq-default fill-column 120)
;; (setq-default indicate-buffer-boundaries 'left)
(setq-default display-fill-column-indicator-character ?\u254e)



(savehist-mode)
(setq history-delete-duplicates t)
(setq savehist-save-minibuffer-history t)
(setq savehist-additional-variables '(kill-ring search-ring regexp-search-ring))



(defvar ctrlwei-third-party-bin-dir (expand-file-name "bin" user-emacs-directory)
  "This directory houses executable files that are used by Emacs.")

(defvar ctrlwei-etc-dir (expand-file-name "etc" user-emacs-directory)
  "This folder contains all third party related configuration files.")



;; Key bindings
(define-key y-or-n-p-map [return] 'act)
(global-set-key-with-arg (kbd "<f7>") find-file (expand-file-name "init.el" user-emacs-directory))
(global-set-key (kbd "C-x C-b") #'ibuffer-other-window)
(global-set-key (kbd "C-_") #'undo-only)
(global-unset-key (kbd "M-q"))
(keymap-unset prog-mode-map "M-q")
(keymap-set prog-mode-map "M-q w" #'prog-fill-reindent-defun)
(global-set-key (kbd "M-q q") #'kill-current-buffer)
(global-set-key (kbd "M-q a") #'kill-buffer-and-window)
(global-set-key (kbd "M-q j") #'next-buffer)
(global-set-key (kbd "M-q k") #'previous-buffer)
(global-set-key (kbd "M-g q") #'list-packages)

(provide 'init-base-config)
;;; init-base-config.el ends here
